<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/base.jsp"%>
<% 
ChronicdisDao dao=new ChronicdisDao();
List<Chronicdis> list=dao.queryOjects("select * from t_chronicdis", null);

 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/admin.css">
<link rel="stylesheet" type="text/css" href="third/autocomplete/jquery.autocomplete.css" />

<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript" src="third/laydate/laydate.js"></script>
<script type="text/javascript" src="third/autocomplete/jquery.autocomplete.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//重新绑定表单提交
		$("#add_btn").bind("click", function() {
			$('form').submit();
		});
		//姓名自动匹配
		var url="<%=path%>/system/PersonSerlvet";
	    $("#persname").autocomplete(url, { 
		   dataType:"json",
		   type: "post",
	       max: 50, //列表里的条目数 
	       minChars: 0, //自动完成激活之前填入的最小字符 
	       scrollHeight: 200, //提示的高度
	       matchContains: true, //包含匹配
	       autoFill: false, //自动填充
		   extraParams: {m:"find",town:"炸瓜瓜了"},
		   parse: function(data) { 
	               var rows = [];
	               for(var i=0; i<data.length; i++){	
	                 rows[rows.length] = 
	                 { data:data[i],
	                   result:data[i].itemName,
	                   value:data[i].itemId
	                 };
	               }           
	               return rows;
	           }, 
	       formatMatch: function(row, i, max) { 
	          return row.itemId ; 
	       },  
	       formatItem: function(row, i, max) { 
		      return  row.itemName+"-"+row.otherName; 
	       }
	    }).result(function(event, row, formatted) { 
		   $("#perscode").val(row.itemId);
	    }); 
	});
</script>

</head>

<body>

	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>增加慢病证档案</strong>
		</div>
		<div class="body-content">
			<form id="form-add" method="post" class="form-x"
				action="<%=path%>/system/ChronicInfoServlet?m=add">
				<div class="form-group">
					<div class="label">
						<label>农合证号：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" id="perscode" name="perscode"
							data-validate="required:请输入农合证号" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>姓名：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" id="persname" name="persname"
							data-validate="required:请输入姓名" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>疾病名称：</label>
					</div>
					<div class="field">
						<select id="illname" name="illcode" class="input w50">
							<% for(Chronicdis m:list){ %>
							<option value="<%=m.getIllcode()%>"><%=m.getIllname() %></option>
						    <% }%>
						</select>
						<div class="tips"></div>
					</div>
				</div>
				
					<div class="form-group">
						<div class="label">
							<label>起始时间：</label>
						</div>
						<div class="field">
							<input type="date" id="starttime" name="starttime" value="2019-5-16" class="input w50"/>
							<div class="tips"></div>
						</div>
					</div>
					<div class="form-group">
						<div class="label">
							<label>结束时间：</label>
						</div>
						<div class="field">
							<input type="date" id="endtime" name="endtime" value="2020-5-16" class="input w50"/>
							<div class="tips"></div>
						</div>
					</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button id="add_btn" class="button bg-main icon-check-square-o"
							type="button">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>

</body>
</html>
